/* 
 * File:   fdecode.h
 * Author: djs
 *
 * Created on February 3, 2011, 4:29 PM
 */

#ifndef FDECODE_H
#define	FDECODE_H
#include<bitset>
#include<fstream>
#include<map>

using namespace std;
extern fstream inputf,outputf;
extern int breakencounter;
class bits
{
public:

    bitset <6> funct;
    bitset <5> shamt;
    bitset <5> rd;
    bitset <5> rt;
    bitset <5> rs;
    bitset <6> op;
    bitset<32> raw;
    string opcode,Rd,Rt,Rs;
    int address,value,target,destination,immediate,op1,op2,issuecycle;
    bool notop,isjump;//not operator memory

    bits();
    void clear();
    int read(int addr);
    void print();
    void disassemble();
    string registernum(bitset<5>);
    void special();
    string immediatec();
    string unsigned_immediate();
    string offset();
    void allreg();
    void bgz();
    string instrindex();
    string baseoffset();
    string unumber(bitset<5>);
    void regimm();
    void shift();
    int gettarget();
    void fprint();
    int getdestination();
    
};

extern map <int,bits> mMemory;
void mInsert (int addr,bits instruction );

#endif	/* FDECODE_H */

